﻿namespace EasyConveyor
{
	/// <summary>
	/// An interface that is implemented by all middleware classes.
	/// </summary>
	public interface IMiddleware
	{
		/// <summary>
		/// Executes the middleware logic and returns a <see cref="bool"/> indicating whether the worker thread should continue on with processing middleware downstream from this one.
		/// </summary>
		/// <param name="context">The context instance that is shared amongst all middleware instances in the pipeline. May be null.</param>
		/// <returns>A <see cref="bool"/> indicating whether downstream processing should continue. True for the worker thread to process the next middleware or false for it to stop further processing of middleware.</returns>
		bool Run(object context);
	}
}
